package com.mason.forum.common;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 马拉圈
 * Date: 2023-10-01
 * Time: 23:33
 */
public enum ResultCode {
    //定义状态码常量
    SUCCESS                             (0, "成功"),
    FAILED                              (1000, "操作失败"),
    FAILED_UNAUTHORIZED                 (1001, "未授权"),
    FAILED_PARAMS_VALIDATE              (1002, "参数校验失败"),
    FAILED_FORBIDDEN                    (1003, "禁⽌访问"),// 重定向专用
    FAILED_CREATE                       (1004, "新增失败"),
    FAILED_NOT_EXISTS                   (1005, "资源不存在"),
    AILED_USER_EXISTS                   (1101, "⽤⼾已存在"),
    FAILED_USER_NOT_EXISTS              (1102, "⽤⼾不存在"),
    FAILED_LOGIN                        (1103, "⽤⼾名或密码错误"),
    FAILED_USER_BANNED                  (1104, "您已被禁⾔, 请联系管理员, 并重新登录."),
    FAILED_TWO_PWD_NOT_SAME             (1105, "两次输⼊的密码不⼀致"),
    ERROR_SERVICES                      (2000, "服务器内部错误"),
    ERROR_IS_NULL                       (2001, "IS NULL."),

    // 关于修改相关的错误描述
    FAILED_BOARD_ARTICLE_COUNT          (1201, "更新板块贴子数失败"),
    FAILED_USER_ARTICLE_COUNT           (1202, "更新用户贴子数失败"),
    FAILED_ARTICLE_Visit_COUNT          (1203, "更新贴子访问量失败"),
    FAILED_ARTICLE_LIKE_COUNT           (1204, "更新贴子点赞数失败"),
    FAILED_ARTICLE_REPLY_COUNT          (1205, "更新贴子回复数失败"),
    FAILED_UPDATE_USER_INFO             (1206, "修改用户信息失败"),
    FAILED_UPDATE_USER_INFO_COMMON      (1207, "当前数据与原数据一样"),
    FAILED_UPDATE_USER_PASSWORD         (1208, "更新密码失败"),
    FAILED_USER_PASSWORD                (1209, "原密码错误"),
    FAILED_MESSAGE_UPDATE_STATE         (1210, "修改站内信状态失败"),

    // 板块相关错误
    FAILED_BOARD_BANNED                 (1301, "板块被禁用"),
    FAILED_BOARD_NOT_EXISTS             (1302, "板块不存在"),

    // 帖子相关错误
    FAILED_ARTICLE_NOT_EXISTS           (1401, "帖子不存在"),
    FAILED_ARTICLE_BANNED               (1402, "帖子被禁用"),
    FAILED_ARTICLE_DELETE               (1403, "帖子删除失败"),

    // 站内信相关
    FAILED_CANNOT_SEND_TO_SELF          (1501, "不能给自己发送站内信"),
    FAILED_MESSAGE_NOT_EXISTS            (1502, "站内信不存在");

    int code;//状态码
    String message;//描述信息

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String toString() {
        return "[ " +
                "code = " + code +
                ", message = '" + message + '\'' +
                ']';
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
